//
//  WXCloudNewsListVideoViewController.m
//  xinguiyang
//
//  Created by 段尹斌 on 2017/12/7.
//  Copyright © 2017年 voc. All rights reserved.
//

#import "WXCloudNewsListVideoViewController.h"
#import "WXCloudNewsListVideoView.h"
#import <WXCloudModuleBaseConfig/WXSystemBaseDefine.h>
#import <WXCloudModuleBaseView/WXNavigationBaseView.h>
#import <WXXHNInternetSupervise/WXInternetSuperviseViewConfigManager.h>
#import <WXCloudModuleCategories/UIView+LayoutMethods.h>
#import <WXCloudModuleCategories/UIView+UIStyle.h>
#import <WXCloudModuleBaseView/WXSystemNormalButton.h>

@interface WXCloudNewsListVideoViewController ()
@property (nonatomic, strong) WXNavigationBaseView *titleView;

@property(nonatomic,strong) UIButton *leftButton;

@property (nonatomic, strong, readwrite) WXCloudNewsListVideoViewModel *viewModel;

@property (nonatomic, strong) WXCloudNewsListVideoView *cloudNewsListVideoView;

@end

@implementation WXCloudNewsListVideoViewController

- (instancetype)initWithViewModel:(WXCloudNewsListVideoViewModel *)viewModel
{
    self = [super init];
    if (self) {
        _viewModel = viewModel;
        [self initialize];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    
    [self.cloudNewsListVideoView bindingTo:self.viewModel];
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden=YES;
}

#pragma mark -私有方法
- (void)initialize
{
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.cloudNewsListVideoView];
    [self.view addSubview: self.titleView];
}
- (WXNavigationBaseView *)titleView
{
    if (_titleView == nil) {
        _titleView = [[WXNavigationBaseView alloc]initWithTitle:_viewModel.chanelTitle];
        _titleView.titleLabel.textColor = [WXInternetSuperviseViewConfigManager sharedInstance].TitleLabelColor;
        _titleView.backgroundColor = [WXInternetSuperviseViewConfigManager sharedInstance].TitleBackgroundColor;
         _titleView.leftBtn = self.leftButton;
        [_titleView addNormalShadow];
        
    }
    return _titleView;
}
-(UIButton *)leftButton{
    if (_leftButton==nil) {
        _leftButton = [WXSystemNormalButton normalBlackBackButton];
        @weakify(self);
        [[_leftButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
            @strongify(self);
            [self.navigationController popViewControllerAnimated:YES];
        }];
    }
    return _leftButton;
}
#pragma mark -懒加载
- (WXCloudNewsListVideoView *)cloudNewsListVideoView
{
    if (_cloudNewsListVideoView == nil) {
        _cloudNewsListVideoView = [[WXCloudNewsListVideoView alloc] initWithFrame:CGRectMake(0,64, WXScreenWidth, WXScreenHeight-64)];
    }
    return _cloudNewsListVideoView;
}

@end
